Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Steps towards Compatibility with Anki 2.1 #72

Closed
wants to merge 10 commits into from

Conversation

Yorwba
Copy link

@Yorwba Yorwba commented Oct 21, 2017

The changes in this PR are not backwards-compatible, so it shouldn't be merged. Anki 2.1 changes a bunch of APIs and uses Python 3/Qt5 instead of Python 2/Qt4, so it would have been difficult not to break compatibility.

Things that work without uncaught exceptions:

  • loading the addon
  • loading the default configuration
  • editing the configuration as raw JSON (that editor is integrated into Anki's addon manager)
  • opening the note editor
  • toggling the addon on and off using the button in the editor
  • auto-filling all the fields
  • reviewing cards

Things that are currently broken:

  • the submenu in the toolbar (i.e. no convenient configuration, no way to fill missing fields in a deck)
  • having the tone colors display in the editor and not just when reviewing

In both cases, the internal interfaces used to implement these features were removed from Anki, apparently in favor of a solution based on HTML/JavaScript. It will be necessary either to hook into their replacements, or to reimplement them.

Although not yet complete, it works well enough that I'll be using it from now on. Hopefully I'll find time to iron out those missing features.

Yorwba added 10 commits October 21, 2017 16:16
…ge structure

Some files were importing Chinese_support, but not actually using it.
Remove those imports.
Some file search paths were dependent on the original addon directory
structure. Make those relative by using the __name__.
Anki no longer builds its UI the same way, there is no rebuildAddonsMenu
step that could be wrapped. Need to figure out some other way to
implement the menu. Maybe a hook in the config editor?
@Yorwba Yorwba mentioned this pull request Oct 28, 2017
@joeminicucci
Copy link

So if I'm not mistaken the only remaining pieces which are breaking the colored editing functionality is cjklib? What is causing the submenu to not showup?

@Yorwba
Copy link
Author

Yorwba commented Jan 3, 2018

No, I don't think there's any issue with cjklib. I have been using this branch for the past few months, and essentially it works. It's just not very user-friendly due to the missing features (like convenient configuration, which is kind of important).

There are no colors in the editor because they require CSS to be injected, but Anki 2.1 has revamped their editor code, so the old CSS injection strategy no longer works. It should be possible to adapt it, though.

The submenu doesn't show up because there no longer is a simple addons menu to hook into, so I commented that code out. This functionality should probably be provided by the "config" button of the new addon manager. Currently that just opens an editor for the raw JSON.

I might have the time to make the necessary changes sometime next week, but no promises. If anyone else wants to try their hand, the code that needs replacing was commented out in a6df731 and 167c118

@muellert
Copy link

muellert commented Sep 1, 2018

I'm confused. Can someone please help me understand what's missing for this addon to work with Anki 2.1? My previous impression was that it is cjklib, which I have started to port, but if this is not the case, then I might prefer to work on something else, eg. polishing other parts of this addon.

@Yorwba
Copy link
Author

Yorwba commented Sep 1, 2018

@muellert You might be better off looking at https://github.com/luoliyan/chinese-support-redux, since the port seems to be significantly more complete than mine.

It's probably better if I close this PR, since it's unlikely that I'll ever complete it at this point.

@Yorwba Yorwba closed this Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants